#ifndef GX_META_PARSER_H
#define GX_META_PARSER_H

#include "Grammar.h"

namespace GxMetaParser
{
	class IllegalGrammarException
	{};

	class ILexer abstract
	{
	public:
		virtual Token GetNextToken()=0;
		virtual Token ReadNextToken()=0;
	};

	struct ParserErrorArgs
	{
		int State;
		int Symbol;
	};

	typedef Event<ParserErrorArgs &> ErrorEvent;

	class MetaParser : public Object
	{
	private:
		ILexer * lexer;
		Grammar * grammar;
		Array<SymbolObject> stack;
	public:
		ErrorEvent OnError;
		MetaParser(ILexer * l, Grammar * g);
		int GetClientObjectCount();
		RefPtr<ClientSymbolObject> GetClientObject(int id);
		bool Parse();
	};
}

#endif